<template>
    <div class="user-info-top">
        <div>
          <img src="../../../../assets/images/user.png" alt="" style="width:56px;height:56px;border-radius: 50%;">
        </div>
        <div style="margin-left: 16px;">
            <div style="line-height:28px;font-size:24px;">{{currentDate}}</div>
            <div style="line-height:22px;color: rgb(51,51,51);font-size:16px"><span>王磊</span></div>
        </div>
    </div>
</template>
<script lang="ts" setup>
  import { computed,onMounted,ref } from 'vue';
  import { useUserStore } from '/@/store/modules/user';
  const userStore = useUserStore();
  const userinfo = computed(() => userStore.getUserInfo);

  const currentDate = ref('');

  function formatDate(date: Date): string {
    const daysOfWeek = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0');
    const day = String(date.getDate()).padStart(2, '0');
    const dayOfWeek = daysOfWeek[date.getDay()];

    return `${year}年${month}月${day}日 ${dayOfWeek}`;
  }

onMounted(() => {
  // 初始化日期
  currentDate.value = formatDate(new Date());
});
</script>
<style scoped>

.user-info-top{
    display: flex;
    height: 100px;
    align-items: center;
    margin-bottom: 16px;
    padding-left: 24px;
    background: url('/src/assets/images/headerBg.png');
    background-repeat: no-repeat;
    background-position: 100%;
    background-size: 75% 100%;
   background-color: #fff;
}
</style>
